<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script type="text/javascript">
        //  1.
                var str1 = 'str';
                str1 += 2;
                var obj = typeof str1;  //obj = string
                if (typeof obj == 'string') {
                    var obj = new String()
                    obj.sign = 'Live'
                }
                console.log(obj.sign);
        
        
        //2.算出字符串的所占用字节的长度， 如: str  ='live' 长度为4      str='live生活'   长度为8 
        //（提示:unicode<=255的占1字节，unicode>255的占用2字节, str.charCodeAt(i)查看i的字节码）
        var a='123456森林马拉松';
        var count=0;
        for (let i = 0; i < a.length; i++) {
            a.charCodeAt(i)<=255 ? count+=1 : count+=2
        }
        console.log(count);
        
        //3.要求输入一串低于10位的数字，输出对应的中文大写:
        //例： input: 10001  --> 一万零一     ；   input:  10,000,000  -->  一千万
        const d=['壹','贰','叁','肆','伍','陆','柒','捌','玖']
        const a=['个','十','百','千','万','十万','百万','千万','亿'];

        var num ='10001';
        Number=(num);
        function Number(num) {
            var num1=num
            if (num1==0) {
                print(d[num[0]])
                return;
            }
            while (num1 !='') {
                if (num1>0) {
                    if (num1[0]==0) {
                        if (num.length<=4) {
                            print(d[num[0]])
                        }
                        else{
                            print(d[num[0]])
                        }
                        if (num[0]>0 || num.length<=4) {
                            print(a[num.length-1])
                        }
                        num=num.b[1]
                        while (num[0]==0 && num[1]==0) {
                            num=num.b[1]
                        }
                    }
                }
            }
            function print(s) {
                 document.write(s)
            }
           
        }
    
            </script>
</body>
</html>